<template>
  <div>
    <span v-for="(item, i) in arr" :key="i">
      <!-- 数组：使用v-model获取表单的value值 -->
      <input type="checkbox" v-model="hobby" :value="item" />{{ item }}
    </span>

    <ul>
      <!-- 取出的item放在data中的hobby -->
      <li v-for="(item, index) in hobby" :key="index">{{ item }}</li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hobby: [],
      arr: ["科幻", "喜剧", "动漫", "冒险", "科技", "军事", "娱乐", "奇闻"],
    };
  },
};
</script> 

<style>
</style>
